<?php
include('bloqueia.php');
include('conexao.php');
$funcao = @$_GET['funcao'];
if($funcao == ""){
	$funcao = "Inserir";}
$id = @$_GET['id'];

$data = date("Y-m-d");

if($funcao == "Editar"){
$sql = mysql_query("SELECT * FROM `especiais` WHERE `id` = '$id'");
		while($linha = mysql_fetch_array($sql)){
			$id		= $linha['id'];
			$post 	= $linha['post'];
			$tit_ 	= $linha['tit'];
			$texto	= $linha['texto'];
			$foto	= $linha['foto'];
			}}
			if($foto == ""){
	$foto = "img.jpg";}
?>

<div id="cadastros"><br>
<h2>Cadastro de Vendas Especiais</h2>
<br>
  <form class="form" action="especiais_cad.php?funcao=<?php echo $funcao ?>&id=<?php echo $id; ?>" method="post" enctype="multipart/form-data" name="form1">
    <table class="table" width="699" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td bgcolor="#E9E9E9">&nbsp;</td>
      <td align="left" bgcolor="#E9E9E9">&nbsp;</td>
    </tr>
    <tr>
      <td width="100" bgcolor="#E9E9E9">&nbsp;</td>
      <td width="599" align="left" bgcolor="#E9E9E9"><img style="float:left; border:1px solid #333;" src="../fotos/<?php echo $foto; ?>" alt="" width="200" height="100" /></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#E9E9E9"><strong>Foto:</strong></td>
      <td align="left" bgcolor="#E9E9E9">
        <input type="file" lang="pt" name="foto" id="foto" /></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#E9E9E9"><strong>Título:</strong></td>
      <td align="left" bgcolor="#E9E9E9"><p style="font-size:11px;">
        <label for="nome"></label>
        <input type="text" name="tit" id="nome" value="<?php echo $tit_; ?>" />
      </p></td>
      </tr>
    <tr>
      <td align="right" bgcolor="#E9E9E9"><strong>Texto:</strong></td>
      <td align="left" bgcolor="#E9E9E9">
        <textarea class="emp" name="texto" id="texto" rows="5" ><?php echo $texto; ?></textarea></td>
    </tr>
    <tr>
      <td bgcolor="#E9E9E9"><input type="hidden" name="post" id="hiddenField" value="<?php echo $data; ?>" /></td>
      <td align="left" bgcolor="#E9E9E9"><input class="bot" type="submit" name="enviar" id="enviar" value="<?php echo $funcao; ?>"></td>
    </tr>
    <tr>
      <td bgcolor="#E9E9E9">&nbsp;</td>
      <td bgcolor="#E9E9E9">&nbsp;</td>
    </tr>
  </table>
</form>
<br />
<br />

<a style="color:#eee;" href="?pagina=especiais">Voltar para listagem das Vendas Especiais.</a>
<br>
<br>


</div>
